<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>复习</title>
  </head>
  <body></body>
  <script>
   var date = '2021/3a12' 
   var reg = /\d{4}([-/])\d{1,2}[\1ab]\d{1,2}/
   console.log(reg.test(date))
   

  </script>
</html>
